package org.yray.io.gcdemo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author lyg
 * @date 2021/10/10 19:36
 */
public class JConsoleLock {

    public static void createBusyThread()
    {
        Thread t=new Thread(()->{
            while (true)
            {

            }
        },"busyThread");
        t.start();
    }
    public static void createLockThread(final Object lock)
    {
        Thread t=new Thread(()->{
            synchronized (lock)
            {
                try {
                    lock.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"lockThread");
        t.start();
    }
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        br.readLine();
        createBusyThread();
        br.readLine();
        Object o=new Object();
        createLockThread(o);
    }
}
